﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="UserList2.aspx.cs" Inherits="BSCMFF.Web.Pages.UserList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">



    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">

        <telerik:RadGrid ID="RadGrid1" runat="server" 
            DataSourceID="EntityDataSource1" GridLines="None" Skin="Windows7" 
            AllowAutomaticDeletes="True" AllowAutomaticInserts="True" 
            AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" 
            AutoGenerateEditColumn="True">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID_User" EditMode="EditForms"
                DataSourceID="EntityDataSource1">
                <Columns>
                    <telerik:GridBoundColumn DataField="ID_User" DataType="System.Int32" 
                        HeaderText="ID_User" ReadOnly="True" SortExpression="ID_User" 
                        UniqueName="ID_User">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Login" HeaderText="Login" 
                        SortExpression="Login" UniqueName="Login">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Password" HeaderText="Password" 
                        SortExpression="Password" UniqueName="Password">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Role.Name" HeaderText="Role" 
                        SortExpression="Role.Name" UniqueName="Role.Name">
                    </telerik:GridBoundColumn><%--
                    <telerik:GridCheckBoxColumn DataField="Enabled" DataType="System.Boolean" 
                        HeaderText="Enabled" SortExpression="Enabled" UniqueName="Enabled">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="User_Setting_FK" DataType="System.Int32" 
                        HeaderText="User_Setting_FK" SortExpression="User_Setting_FK" 
                        UniqueName="User_Setting_FK">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Role_FK" DataType="System.Int32" 
                        HeaderText="Role_FK" SortExpression="Role_FK" UniqueName="Role_FK">
                    </telerik:GridBoundColumn>--%>
                    <telerik:GridButtonColumn CommandName="Select" Text="Select" 
                        UniqueName="column">
                    </telerik:GridButtonColumn>
                </Columns>
                 <EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit User: {0}" EditColumn-ButtonType="ImageButton"
                    CaptionDataField="ID_User" EditFormType="Template">
                    <FormTemplate>
                        <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
                            <tr>
                                <td>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Login:
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox10" Text='<%# Bind( "Login") %>' runat="server">
                                    </asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Password:
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBox11" Text='<%# Bind( "Password") %>' runat="server">
                                    </asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Title:
                                </td>
                                <td>
                                    <%--<asp:TextBox ID="TextBox12" Text='<%# Eval( "Role.Name") %>' runat="server">
                                    </asp:TextBox>--%>
                                    <%--<asp:DropDownList ID="ddl1" DataSourceID="EntityDataSourceRoles" DataValueField="ID_Role"
                                                    DataTextField="Name" runat="server"
                                                    ></asp:DropDownList>--%>
                                    <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Role_FK") %>' 
                                        DataSourceID="EntityDataSourceRoles" DataValueField="ID_Role" 
                                                    DataTextField="Name"
                                        Style="z-index: 1;">
                                        <%--<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>--%>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                          
                        </table>
                        <table style="width: 100%">
                            <tr>
                                <td align="right" colspan="2">
                                    <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button>&nbsp;
                                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                    </asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
            <HeaderContextMenu EnableAutoScroll="True">
            </HeaderContextMenu>
        </telerik:RadGrid>
        
</telerik:RadAjaxPanel>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="Users" Include="Role">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EntityDataSourceRoles" runat="server" 
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableFlattening="False" EntitySetName="Role">
    </asp:EntityDataSource>
    
  <%--  <asp:EntityDataSource ID="EntityDataSource2" runat="server">
        </asp:EntityDataSource>--%>
</asp:Content>